<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入在线的leaflet依赖 -->
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"
        integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
    <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"
        integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
    <!-- js依赖 -->
    <!-- <script src="https://lib.baomitu.com/leaflet/1.9.2/leaflet.js"></script> -->
    <!-- css依赖 -->
    <!-- <link rel="stylesheet" href="https://lib.baomitu.com/leaflet/1.9.2/leaflet.css"> -->
    <!-- 沿着坐标路径绘制图案 -->
    <script
        src="https://cdn.jsdelivr.net/npm/leaflet-polylinedecorator@1.6.0/dist/leaflet.polylineDecorator.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            height: 100vh;
        }
    </style>
</head>

<body>
    <div id="map"></div>
    <script>
        var url = 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiY2hlbmdiZW5jaGFvIiwiYSI6ImNsODU3aGRiODA0Y2UzcHBzZmFlcmdqZ2sifQ.8k59W_pB_Riwe6o-MneRlA'
        var layer = L.tileLayer(url, {
            maxZoom: 19,
            attribution: '© OpenStreetMap'
        })
        const map = L.map("map", {
            center: [0, 0],
            zoom: 1,
            layers: [layer]
        })
        //绘制图层
        var drawnItems = new L.FeatureGroup();
        //添加绘制图层
        map.addLayer(drawnItems);
        /* 5.-------------------------------------------------------- */
        //线要素点集
        var multiCoords1 = [
            [[-27.5468, -70.7910], [-28.8068, -70.1318], [-29.1242, -69.6699], [-29.4966, -67.2958], [-11.4266, -68.8564], [-11.7542, -68.1093]],
            [[-28.0193, -72.8125], [-26.3165, -72.8564], [-24.9336, -71.0107], [-24.5278, -69.5820], [-24.8714, -67.7353], [-25.8287, -65.1855], [-28.1953, -65.1416]],
            [[-25.9205, -70.4394], [-26.7699, -70.9228], [-27.6061, -68.5488], [-27.7540, -67.3837]]
        ];
        var plArray = [];
        for (var i = 0; i < multiCoords1.length; i++) {
            //添加线
            plArray.push(L.polyline(multiCoords1[i]).addTo(drawnItems));
        }
        //添加线上显示样式
            L.polylineDecorator(multiCoords1, {
                //添加模式
                patterns: [
                    {
                        //模式符号的偏移位置
                        offset: 25,
                        //模式符号的重复间隔
                        repeat: 100,
                        //符号实例
                        symbol: L.Symbol.arrowHead({
                            //符号大小
                            pixelSize: 15,
                            //符号样式
                            pathOptions: {
                                //填充色透明度
                                fillOpacity: 1,
                                //线宽
                                weight: 0
                            }
                        })
                    }
                ]
            }).addTo(drawnItems);
    </script>
</body>

</html>